package StateManagementIRPConstDefs;

/**
 * Generated from IDL union "UnknownStatusTypeOpt".
 *
 * @author JacORB IDL compiler V 2.3.0, 17-Feb-2007
 * @version generated at 2013-5-20 22:07:19
 */

public final class UnknownStatusTypeOptHelper
{
	private static org.omg.CORBA.TypeCode _type;
	public static void insert (final org.omg.CORBA.Any any, final StateManagementIRPConstDefs.UnknownStatusTypeOpt s)
	{
		any.type(type());
		write( any.create_output_stream(),s);
	}

	public static StateManagementIRPConstDefs.UnknownStatusTypeOpt extract (final org.omg.CORBA.Any any)
	{
		return read(any.create_input_stream());
	}

	public static String id()
	{
		return "IDL:StateManagementIRPConstDefs/UnknownStatusTypeOpt:1.0";
	}
	public static UnknownStatusTypeOpt read (org.omg.CORBA.portable.InputStream in)
	{
		UnknownStatusTypeOpt result = new UnknownStatusTypeOpt ();
		boolean disc=in.read_boolean();
			if (disc == true)
			{
				StateManagementIRPConstDefs.UnknownStatus _var;
				_var=StateManagementIRPConstDefs.UnknownStatusHelper.read(in);
				result.unknown_status (_var);
			}
		return result;
	}
	public static void write (org.omg.CORBA.portable.OutputStream out, UnknownStatusTypeOpt s)
	{
		out.write_boolean(s.discriminator ());
			if (s.discriminator () ==true)
			{
				StateManagementIRPConstDefs.UnknownStatusHelper.write(out,s.unknown_status ());
			}
	}
	public static org.omg.CORBA.TypeCode type ()
	{
		if (_type == null)
		{
			org.omg.CORBA.UnionMember[] members = new org.omg.CORBA.UnionMember[1];
			org.omg.CORBA.Any label_any;
			label_any = org.omg.CORBA.ORB.init().create_any ();
			label_any.insert_boolean (true);
			members[0] = new org.omg.CORBA.UnionMember ("unknown_status", label_any, StateManagementIRPConstDefs.UnknownStatusHelper.type(),null);
			 _type = org.omg.CORBA.ORB.init().create_union_tc(id(),"UnknownStatusTypeOpt",org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(8)), members);
		}
		return _type;
	}
}
